package com.example.mygrade.service;

import com.example.mygrade.domain.Student;
import com.example.mygrade.domain.Teacher;
import com.example.mygrade.repository.TeacherRepository;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Service
public interface TeacherService {

    /**
     * 获取教师信息
     */
    List<Teacher> findAll();

    /**
     * 按id进行查询
     * @param id
     * @return
     */
    Teacher findById(Integer id);

    /**
     * 插入教师信息
     */
    Teacher insert(Teacher teacher);

    /**
     * 更新教师信息
     */
    Teacher update(Teacher teacher);

    /**
     * 删除教师信息
     */
    void delete(Integer id);

    /**
     * 批量删除教师信息
     * @param arr
     */
    void delete(Integer[] arr);

    /**
     * 只支持分页的查询
     * @param pageable
     * @return
     */
    Page<Teacher> findAll(Pageable pageable);

    Page<Teacher> findAll(Example<Teacher> teacherExample, Pageable pageable);

    int insertTeacher(MultipartFile file) throws Exception;

    List<Teacher> findByTnameAndPassword(String name,String password);

    public Teacher findByTnameLike(String name);

    void exportTeacher(HttpServletResponse response);
}
